<!-- 继承base.html模板 -->
{% extends 'myadmin/base.html' %}
<!-- 模板继承 -->
{% block main_body %}
   <!-- Content Header (Page header) -->
   <section class="content-header">
    <h1>
      店铺管理
      <small>订餐系统店铺管理</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
      <li class="active">店铺管理</li>
    </ol>
  </section>
  <!-- Main content -->
  <section class="content container-fluid">

    <div class="row">
      <div class="col-xs-12">
        <div class="box">
          <div class="box-header">
            <h3 class="box-title">店铺信息表</h3>
            
            <div class="box-tools">
              <form action="{% url 'myadmin_shop_index' 1 %}" method="get">
                <div class="input-group input-group-sm" style="width:150px;">
                  <input type="text" name="keyword" class="form-control pull-right" placeholder="店铺名称">

                  <div class="input-group-btn">
                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                  </div>
                </div>
                </form>
          </div>
          </div>
          <!-- /.box-header -->
          <div class="box-body table-responsive no-padding">
            <table class="table table-hover">
              <tr>
                <th>id</th>
                <th>店铺名称</th>
                <th>封面图片</th>
                <th>Logo图片</th>
                <th>电话</th>
                <th>当前状态</th>
                <th>添加时间</th>
                <th>修改时间</th>
                <th>操作</th>
              </tr>
              {% for vo in shoplist %}
              <tr>
                <td>{{vo.id}}</td>
                <td>{{vo.name}}</td>
                <td><img src="/static/uploads/shop/{{vo.cover_pic}}" width="60" ></td>
                <td><img src="/static/uploads/shop/{{vo.banner_pic}}" width="60" ></td>
                <td>{{vo.phone}}</td>

                <td>
                {% if vo.status == 1 %}
                    <span style="color: lawngreen;">正常</span>
                {% elif vo.status == 2 %}
                    <span style="color: yellow;">禁用</span>
                {% elif vo.status == 9 %}
                    <span style="color: rgb(255, 0, 0);">删除</span>
                {% else %}
                    <span style="color: rgb(0, 0, 0);">未知状态</span>
                {% endif %}    
                </td>
                <td>{{vo.create_at|date:'Y-m-d'}}</td>
                <td>{{vo.update_at|date:'Y-m-d'}}</td>
                <td>
                  <a type="button" href="{% url 'myadmin_shop_edit' vo.id %}" class="btn btn-success btn-xs">
                    <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 编辑</a>
                  <button type="button" onclick='doDel("{% url 'myadmin_shop_delete' vo.id %}")' class="btn btn-danger btn-xs">
                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除</button>
                </td>
              </tr>
              {% endfor %}

            </table>
          </div>
          <!-- /.box-body -->
          <div class="box-footer clearfix">
            <a role="button" href="{% url 'myadmin_shop_add' %}" class="btn btn-primary">
              <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 添加店铺</a>
            <ul class="pagination pagination-sm no-margin pull-right">
              <li><a href="{% url 'myadmin_shop_index' ppindex|add:-1 %}?{{mywhere|join:'&'}}">&laquo;</a></li>
              {% for p in plist %}
              <li {% if p == ppindex %}class="active"{% endif %}><a href="{% url 'myadmin_shop_index' p %}?{{mywhere|join:'&'}}">{{p}}</a></li>
              {% endfor %}
              <li><a href="{% url 'myadmin_shop_index' ppindex|add:1 %}?{{mywhere|join:'&'}}">&raquo;</a></li>
            </ul>
          </div>

          </div>
        <!-- /.box -->
      </div>
    </div>

  </section>
  <!-- /.content -->
{% endblock %}

